package com.yootk.client;

import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class UDPClient {
    public static  void  main(String[] args) throws  Exception{
        DatagramSocket client=new DatagramSocket(9999);
        byte data[]=new byte[1024];
        DatagramPacket packet=new DatagramPacket(data,data.length);
        System.out.println("【UDPClient】客户端等待服务端发送消息......");
        client.receive(packet);
        System.out.println("【UDPClient】接收到消息，消息内容为："+ new String(data,0,packet.getLength()));
        client.close();
    }
}
